//
//  BGNavigatiionController.m
//  bigMall
//
//  Created by ios on 16/7/6.
//  Copyright © 2016年 thinklev. All rights reserved.
//

#import "BGNavigatiionController.h"
#import "BGHomeTableViewController.h"
#import "BGShopTableViewControler.h"
#import "BGTenderTableViewController.h"
#import "BGAuctionTableViewController.h"
#import "BGProfileViewController.h"

@interface BGNavigatiionController ()

@end

@implementation BGNavigatiionController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (NSArray *)createNavigation {
    
    //Home
    BGHomeTableViewController *home = [[BGHomeTableViewController alloc] init];
    
    BGNavigatiionController *homeNav = [[BGNavigatiionController alloc] initWithRootViewController:home];
    
    homeNav.tabBarItem.title = @"主页";
    [homeNav.tabBarItem setImage:[UIImage imageNamed:@"主页未选中"]];
    UIImage *select = [UIImage imageNamed:@"主页"];
    [homeNav.tabBarItem  setSelectedImage:[select imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    home.title = @"惠煤网";
    [homeNav.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   [UIColor redColor],NSForegroundColorAttributeName,
                                                   nil] forState:UIControlStateSelected];
    [home.navigationController.navigationBar setBarTintColor:[UIColor redColor]];
    
    //Shop
    BGShopTableViewControler *shop = [[BGShopTableViewControler alloc] init];
    
     BGNavigatiionController *shopNav = [[BGNavigatiionController alloc] initWithRootViewController:shop];
    [shopNav.tabBarItem setImage:[UIImage imageNamed:@"商城-(1)"]];
    UIImage *select1 = [UIImage imageNamed:@"组-58"];
    [shopNav.tabBarItem  setSelectedImage:[select1 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    shopNav.tabBarItem.title = @"商城";
    shop.title = @"商城";
    [shopNav.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   [UIColor redColor],NSForegroundColorAttributeName,
                                                   nil] forState:UIControlStateSelected];
    [shop.navigationController.navigationBar setBarTintColor:[UIColor redColor]];
    
    //Auction
    BGAuctionTableViewController *auction = [[BGAuctionTableViewController alloc] init];
    
    BGNavigatiionController *auctionNav = [[BGNavigatiionController alloc] initWithRootViewController:auction];
    [auctionNav.tabBarItem setImage:[UIImage imageNamed:@"拍卖未点击"]];
    UIImage *select2 = [UIImage imageNamed:@"拍卖2"];
    [auctionNav.tabBarItem  setSelectedImage:[select2 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    auctionNav.tabBarItem.title = @"拍卖";
    auction.title = @"拍卖";
    [auctionNav.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   [UIColor redColor],NSForegroundColorAttributeName,
                                                   nil] forState:UIControlStateSelected];
    
    [auction.navigationController.navigationBar setBarTintColor:[UIColor redColor]];

    //Tender
    BGTenderTableViewController *tender = [[BGTenderTableViewController alloc] init];
    
    BGNavigatiionController *tenderNav = [[BGNavigatiionController alloc] initWithRootViewController:tender];
    [tenderNav.tabBarItem setImage:[UIImage imageNamed:@"招标-(1)"]];
    UIImage *select3 = [UIImage imageNamed:@"组-55"];
    [tenderNav.tabBarItem  setSelectedImage:[select3 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [tenderNav.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                   [UIColor redColor],NSForegroundColorAttributeName,
                                                   nil] forState:UIControlStateSelected];
    tenderNav.tabBarItem.title = @"招标";
    tender.title = @"招标";
    
    [tender.navigationController.navigationBar setBarTintColor:[UIColor redColor]];
    
    //Profile
    BGProfileViewController *profile= [[BGProfileViewController alloc] init];
    
    BGNavigatiionController *profileNav = [[BGNavigatiionController alloc] initWithRootViewController:profile];
    [profileNav.tabBarItem setImage:[UIImage imageNamed:@"我的-(3)"]];
    UIImage *select4 = [UIImage imageNamed:@"我的已经点击"];
    [profileNav.tabBarItem  setSelectedImage:[select4 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    profileNav.tabBarItem.title = @"我的";
    [profileNav.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                  [UIColor redColor],NSForegroundColorAttributeName,
                                                   nil] forState:UIControlStateSelected];
    profile.title = @"用户中心";
    
    [profile.navigationController.navigationBar setBarTintColor:[UIColor redColor]];
    
    //创建了NSArry
    NSArray *arr = [NSArray arrayWithObjects:homeNav,shopNav,tenderNav,auctionNav,profileNav, nil];

    return arr;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
